package com.woyou.demo.controller

import org.apache.commons.text.StringEscapeUtils
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.PathVariable

@RestController
class DemoController{
    @RequestMapping("/index")
    fun hello(name: String = "World"): String{
        val escapedName = StringEscapeUtils.escapeHtml4(name)
        return "Hello $escapedName"
    }

    @RequestMapping("/name/{name}")
    fun name(@PathVariable name: String): String{
        val escapedName = StringEscapeUtils.escapeHtml4(name)
        return "Hello $escapedName"
    }

}
